

/* Replication file for Table 1 */

/* Descriptive statistics and balance test for framing experiment (1 qn). Note that assist=control, welfare=treatment.
   No individual-level data for region.  */

use "C:\Users\ls42\Dropbox\google consumer surveys\Replication Materials\framing_1qn.dta", clear


/* gender */

tab group gender, row  /*this is to calculate the percentage of each gender by treatment group (results shown in row 1 and 2, coloumn 2 & 3 
                          of table 1) */
tab gender, gen(gender)

foreach i of numlist 1/2 {  /* diff. in proportion test for gender across treatment groups */

prtest gender`i', by(group)

}

/* age */

tab group age, row  /*this is to calculate the percentage of age categories by treatment group (results shown in row 3 to 8, coloumn 2 & 3 
                      of table 1) */
tab age, gen(age)

foreach i of numlist 1/6 {  /* diff. in proportion test for age categories across treatment groups */

prtest age`i', by(group)

}

/* income */

tab group income, row  /*this is to calculate the percentage of income categories by treatment group (results shown in row 9 to 13, coloumn 2 & 3 
                          of table 1) */
tab income, gen(income)

foreach i of numlist 1/5 {

prtest income`i', by(group)  /* diff. in proportion test for income categories across treatment groups */

}



/* Descriptive statistics and balance test for asian disease experiment. No individual-level data for region.  */

use "C:\Users\ls42\Dropbox\google consumer surveys\Replication Materials\asian_disease.dta", clear


/* gender */

tab group gender, row  /*this is to calculate the percentage of gender by treatment group (results shown in row 1 to 2, coloumn 6 & 7 
                          of table 1) */
tab gender, gen(gender)

foreach i of numlist 1/2 {  /* diff. in proportion test for gender across treatment groups */

prtest gender`i', by(group)

}

/* age */

tab group age, row /*this is to calculate the percentage of age categories by treatment group (results shown in row 3 to 8, coloumn 6 & 7 
                          of table 1) */
tab age, gen(age)

foreach i of numlist 1/6 {  /* diff. in proportion test for age categories across treatment groups */

prtest age`i', by(group)

}

/* income */

recode income 3=2 /* Combine 150k+ category into 100k+ category */

tab group income, row  /*this is to calculate the percentage of income categories by treatment group (results shown in row 9 to 13, coloumn 6 & 7 
                          of table 1) */
tab income, gen(income)

foreach i of numlist 1/5 {

prtest income`i', by(group) /* diff. in proportion test for income categories across treatment groups */

}




/* Descriptive statistics and balance test for list experiment (female president). No individual-level data for region.  */

use "C:\Users\ls42\Dropbox\google consumer surveys\Replication Materials\list_femaleprez.dta", clear


/* gender */

tab group gender, row  /*this is to calculate the percentage of gender by treatment group (results shown in row 1 to 2, coloumn 8 & 9 
                          of table 1) */
tab gender, gen(gender)

foreach i of numlist 1/2 {  /* diff. in proportion test for gender across treatment groups */

prtest gender`i', by(group)

}

/* age */

tab group age, row   /*this is to calculate the percentage of age categories by treatment group (results shown in row 3 to 8, coloumn 8 & 9
                          of table 1) */
tab age, gen(age)

foreach i of numlist 1/6 {   /* diff. in proportion test for age categories across treatment groups */

prtest age`i', by(group)

}

/* income */

recode income 3=2 /* Combine 150k+ category into 100k+ category */

tab group income, row    /*this is to calculate the percentage of income categories by treatment group (results shown in row 9 to 13, coloumn 8 & 9 
                          of table 1) */
tab income, gen(income)

foreach i of numlist 1/5 {  /* diff. in proportion test for income categories across treatment groups */

prtest income`i', by(group)

}



/* Descriptive statistics and balance test for list experiment (immigration). No individual-level data for region.  */

use "C:\Users\ls42\Dropbox\google consumer surveys\Replication Materials\list_immg.dta", clear

/* gender */

tab group gender, row  /*this is to calculate the percentage of gender by treatment group (results shown in row 1 to 2, coloumn 10 & 11 
                          of table 1) */
tab gender, gen(gender)

foreach i of numlist 1/2 {    /* diff. in proportion test for gender across treatment groups */

prtest gender`i', by(group)

}

/* age */

tab group age, row   /*this is to calculate the percentage of age categories by treatment group (results shown in row 3 to 8, coloumn 10 & 11
                          of table 1) */
tab age, gen(age)

foreach i of numlist 1/6 {    /* diff. in proportion test for age categories across treatment groups */

prtest age`i', by(group)

}

/* income */

tab group income, row   /*this is to calculate the percentage of income categories by treatment group (results shown in row 9 to 13, coloumn 10 & 11 
                          of table 1) */
tab income, gen(income)

foreach i of numlist 1/5 {   /* diff. in proportion test for income categories across treatment groups */

prtest income`i', by(group)

}






/* Descriptive statistics and balance test for framing experiment (10 qn). No individual-level data for region.  */

use "C:\Users\ls42\Dropbox\google consumer surveys\Replication Materials\framing_10qn.dta", clear

/*Drop unknown values*/

recode gender 3=.
recode age 7=.
recode income 7/8=.

/* inferred gender */

tab group gender, row  /*this is to calculate the percentage of inferred gender by treatment group (results shown in row 1 to 2, coloumn 3 & 4 
                          of table 1) */
tab gender, gen(gender)

foreach i of numlist 1/2 {    /* diff. in proportion test for inferred gender across treatment groups */

prtest gender`i', by(group)

}

/* inferred age */

tab group age, row  /*this is to calculate the percentage of inferred age categories by treatment group (results shown in row 3 to 8, coloumn 3 & 4 
                          of table 1) */
tab age, gen(age)

foreach i of numlist 1/6 {  /* diff. in proportion test for inferred age categories across treatment groups */

prtest age`i', by(group)

}

/* inferred income */

recode income 3=2 /* Combine 150k+ category into 100k+ category */
tab group income, row  /*this is to calculate the percentage of inferred income categories by treatment group 
                          (results shown in row 9 to 13, coloumn 3 & 4 of table 1) */
tab income, gen(income)

foreach i of numlist 1/5 {  /* diff. in proportion test for inferred income categories across treatment groups */

prtest income`i', by(group)

}

/* destring the variables */

encode Question2Answer, gen(gender_report)
encode Question1Answer, gen(age_report)
encode Question8Answer, gen(income_report)


/*Drop unknown values*/

recode gender_report 2=.
recode age_report 7=.


/* self-reported gender */

tab group gender_report, row  /*this is to calculate the percentage of self-reported gender by treatment group 
                                (results shown in row 1 to 2, coloumn 13 & 14 of table 1) */
tab gender_report, gen(gender_report)

foreach i of numlist 1/2 {     /* diff. in proportion test for self-reported gender across treatment groups */

prtest gender_report`i', by(group)

}

/* self-reported age */

tab group age_report, row    /*this is to calculate the percentage of self-reported age categories by treatment group 
                                (results shown in row 3 to 8, coloumn 13 & 14 of table 1) */
tab age_report, gen(age_report)

foreach i of numlist 1/6 {    /* diff. in proportion test for self-reported age categories across treatment groups */

prtest age_report`i', by(group)

}


/* self-reported income */

recode income_report 3=2 /* Combine 150k+ category into 100k+ category */
tab group income_report, row  /*this is to calculate the percentage of self-reported income categories by treatment group 
                                (results shown in row 9 to 13, coloumn 13 & 14 of table 1) */
tab income_report, gen(income_report)

foreach i of numlist 1/5 {   /* diff. in proportion test for self-reported income categories across treatment groups */

prtest income_report`i', by(group)

}


/* self-reported education */

rename Question7Answer edu
tab group edu, row  /*this is to calculate the percentage of self-reported education categories by treatment group 
                                (results shown in row 14 to 19, coloumn 13 & 14 of table 1) */
tab edu, gen(edu)

foreach i of numlist 1/6 {   /* diff. in proportion test for self-reported education categories across treatment groups */

prtest edu`i', by(group)

}


/* self-reported pid */

encode Question5Answer, gen(pid)

recode pid 2=4 3=5 /* recode leaners into partisans */
tab group pid, row  /*this is to calculate the percentage of self-reported party id categories by treatment group 
                                (results shown in row 20 to 22, coloumn 13 & 14 of table 1) */
tab pid, gen(pid)

foreach i of numlist 1/3 {    /* diff. in proportion test for self-reported party id categories across treatment groups */

prtest pid`i', by(group)

}


/* self-reported ideology */

encode Question6Answer, gen(ideology)

recode ideology 2=1 3=4 /* recode extremes */
tab group ideology, row   /*this is to calculate the percentage of self-reported ideology categories by treatment group 
                                (results shown in row 23 to 25, coloumn 13 & 14 of table 1) */
tab ideology, gen(ideology)

foreach i of numlist 1/3 {  /* diff. in proportion test for self-reported ideology categories across treatment groups */

prtest ideology`i', by(group)

}



















